﻿namespace WMS6.Web
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Web;
    using WMS6.Web.OutboundServiceRef;

    public class OutboundServiceClientProxy : BasePage
    {
        public string AutoAllocate(List<string> orderIDS, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.AutoAllocate(orderIDS, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string AutoPreAllocate(string orderID, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.AutoPreAllocate(orderID, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string AutoRevertAllocate(string orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string updatedBy = base.UserInfo.UserID;
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.AutoRevertAllocate(orderID, updatedBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string AutoRevertPreAllocate(string orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.AutoRevertPreAllocate(orderID, pubParasInfo.UserID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string BatchAllocate(string orderID, List<string> orderLineIDs, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.BatchAllocate(orderID, orderLineIDs, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string BatchClosed(List<string> waveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.BatchClosed(waveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public void BatchConfirmPicked(string waveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                client.BatchConfirmPicked(waveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
        }

        public string BatchOrderActions(string batchOrderID, string batchOrderType)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.BatchOrderActions(batchOrderID, batchOrderType, pubParasInfo.UserID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string BatchPreAllocate(string orderID, List<string> orderLineIDs, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.BatchPreAllocate(orderID, orderLineIDs, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public void BatchShipping(string waveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                client.BatchShipping(waveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
        }

        public string CancelShipping(List<string> PickDetailID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CancelShipping(PickDetailID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string CancelShippingByOrderID(List<string> orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CancelShippingByOrderID(orderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string CancelShippingByOrderIDOrderLineID(string orderID, List<string> LindID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CancelShippingByOrderIDOrderLineID(orderID, LindID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string CheckExternalIDExist(string externalID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CheckExternalIDExist(externalID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public List<InvLotLocLpnInfo> CheckLocationQty4Allocation(ManualAllocateParams manualAllocateParams)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            List<InvLotLocLpnInfo> invLotLocLpnInfoList = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                invLotLocLpnInfoList = client.CheckLocationQty4Allocation(manualAllocateParams, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return invLotLocLpnInfoList;
        }

        public string CheckSkuIDExist(string orderID, string skuID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CheckSkuIDExist(orderID, skuID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ClosedByOrderID(List<string> orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ClosedByOrderID(orderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ConfirmPicked(List<string> pickDetailID, List<string> toLoc, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ConfirmPicked(pickDetailID, toLoc, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ConfirmShipped(List<string> pickDetailID, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ConfirmShipped(pickDetailID, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string CreateOwnerTransferbyOrderIdLineID(string orderID, List<string> lineID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.CreateOwnerTransferbyOrderIdLineID(orderID, lineID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DeleteOrderSelectionInfos(List<string> orderSelectionID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DeleteOrderSelectionInfos(orderSelectionID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DeleteShipmentContainer(List<string> ContainerID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DeleteShipmentContainer(ContainerID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DeleteShippingOrderDetailByOrderIDsAndLineIDs(List<string> orderIDs, List<string> lineIDs)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DeleteOrderDetail(orderIDs, lineIDs, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DeleteShippingOrderInfo(List<string> ordersID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DeleteOrdersInfos(ordersID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DeleteWave(List<string> WaveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DeleteWave(WaveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string DirectAllocation(string orderID, List<string> orderLineIDS)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.DirectAllocation(orderID, orderLineIDS, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string EncaseNesting(string strFromID, string strToID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.EncaseNesting(strFromID, strToID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ExecuteExploding(List<string> orderIDs, List<string> lineIDs)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ExecuteExploding(orderIDs, lineIDs, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public DataSet GetAllIntransit()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetAllIntransit(pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetAllOrdersInfo()
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = new DataSet();
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public static OutboundServiceClientProxy GetInstance()
        {
            return new OutboundServiceClientProxy();
        }

        public IntransitInfo GetIntransitInfoByID(string IntransitID, string srcDbID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            IntransitInfo intransitInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                intransitInfo = client.GetIntransitInfoByID(IntransitID, srcDbID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return intransitInfo;
        }

        public DataSet GetIntransitInfoByQueryEntity(IntransitQueryEntity intransitQuery)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetIntransitByQueryEntity(intransitQuery, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public string GetOrderIDsByWaveID(string waveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.GetOrderIDsByWaveID(waveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public DataSet GetOrdersByOrderSelection(OrderSelectionInfo OrderSelection)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetOrdersByOrderSelection(OrderSelection, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public OrderSelectionInfo GetOrderSelectionByID(string OrderSelectionID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrderSelectionInfo orderSelectionInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                orderSelectionInfo = client.GetOrderSelectionByID(OrderSelectionID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return orderSelectionInfo;
        }

        public DataSet GetOrderSelectionByQueryEntity(OrderSelectionQueryEntity OrderSelectionQuery)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetOrderSelectionByQueryEntity(OrderSelectionQuery, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public OrdersInfo GetOrdersInfoAndDetailListByID(string OrderID, string ContainerID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrdersInfo ordersInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ordersInfo = client.GetOrdersInfoAndDetailListByID(OrderID, ContainerID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ordersInfo;
        }

        public OrdersInfo GetOrdersInfoByOrderID(string orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrdersInfo ordersInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ordersInfo = client.GetOrdersInfoByID(orderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ordersInfo;
        }

        public OrdersInfo GetOrdersInfoByQueryEntity(OrderDetailQueryEntity orderDetailQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrdersInfo ordersInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ordersInfo = client.GetOrdersInfoByQueryEntity(orderDetailQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ordersInfo;
        }

        public DataSet GetOrdersInfoByQueryEntity(OrdersQueryEntity ordersQuery)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetOrdersByQueryEntity(ordersQuery, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetPickDetailInfoByQueryEntity(PickDetailQueryEntity pickDetailQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetPickDetailInfoByQueryEntity(pickDetailQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public ShipmentContainerInfo GetShipmentContainerByID(string ContainerID, string OrderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            ShipmentContainerInfo shipmentContainerInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                shipmentContainerInfo = client.GetShipmentContainerByID(ContainerID, OrderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return shipmentContainerInfo;
        }

        public OrderDetailInfo GetShippingOrderDetailByID(string OrderID, string LineID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrderDetailInfo orderDetailInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                orderDetailInfo = client.GetShippingOrderDetailByID(OrderID, LineID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return orderDetailInfo;
        }

        public OrdersInfo GetShippingWeightByOrderID(string orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            OrdersInfo ordersInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ordersInfo = client.GetShippingWeightByOrderID(orderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ordersInfo;
        }

        public WaveInfo GetWaveByID(string waveID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            WaveInfo waveInfo = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                waveInfo = client.GetWaveByID(waveID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return waveInfo;
        }

        public DataSet GetWaveByQueryList(WaveQueryEntity waveQuery)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                ds = client.GetWaveByQueryList(waveQuery, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        private PubParasInfo InitPubParasInfo()
        {
            if (base.UserInfo != null)
            {
                return new PubParasInfo { UserID = base.UserInfo.UserID, UserLanguage = base.UserInfo.Preference.Lang, CurrentWH = base.UserInfo.CurrentWH };
            }
            HttpContext.Current.Response.Redirect("../Login.aspx?from=Logout", true);
            return null;
        }

        public string InsertOrderSelectionInfo(OrderSelectionInfo orderSelectionInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.InsertOrderSelectionInfo(orderSelectionInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string InsertShipmentContainer(List<ShipmentContainerInfo> shipmentContainerInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.InsertShipmentContainer(shipmentContainerInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string InsertShippingOrderDetailInfo(OrderDetailInfo orderDetailInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.InsertOrderDetailInfo(orderDetailInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string InsertShippingOrderInfo(OrdersInfo ordersInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.InsertOrdersInfo(ordersInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string InsertWave(WaveInfo waveInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.InsertWave(waveInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ManualAllocate(List<PickDetailInfo> pickDetailInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ManualAllocate(pickDetailInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ReleasePcTasks(List<string> RequestID, string updateby, string PcStatus)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ReleasePcTasks(RequestID, updateby, PcStatus, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ReleasePickTasks(List<string> pickDetailID, string updateby)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ReleasePickTasks(pickDetailID, updateby, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string RevertAllocate(List<string> pickDetailIDs)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string updatedBy = base.UserInfo.UserID;
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.RevertAllocate(pickDetailIDs, updatedBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string RevertPicked(List<string> pickDetailID, string updateBy)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.RevertPicked(pickDetailID, updateBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string RevertPickedAllocated(List<string> pickDetailID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string updatedBy = base.UserInfo.UserID;
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.RevertPickedAllocated(pickDetailID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string RevertPreAllocate(string orderID, List<string> lineIDs)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.RevertPreAllocate(orderID, lineIDs, pubParasInfo.UserID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ScanShipmentContainer(List<ShipmentContainerInfo> shipmentContainerInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ScanShipmentContainer(shipmentContainerInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ShippedByOrderID(List<string> orderID, string shippDate)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string updatedBy = base.UserInfo.UserID;
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ShippedByOrderID(orderID, shippDate, updatedBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ShippedByOrderLineID(string orderID, string shippDate, List<string> orderLineIDs)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string updatedBy = base.UserInfo.UserID;
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ShippedByOrderLineID(orderID, orderLineIDs, shippDate, updatedBy, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string ShippingWeightCancelOrder(List<string> orderID)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.ShippingWeightCancelOrder(orderID, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpateActualShipDateByOrderID(string OrderID, string actualShipDate)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpateActualShipDateByOrderID(OrderID, actualShipDate, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpateActualShipDateByOrderIDLineID(string OrderID, List<string> LineID, string actualShipDate)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpateActualShipDateByOrderIDLineID(OrderID, LineID, actualShipDate, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpateActualShipDateByPickDetailID(List<string> pickDetailID, List<string> OrderID, List<string> LineID, string actualShipDate)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpateActualShipDateByPickDetailID(pickDetailID, OrderID, LineID, actualShipDate, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateOrdersByShippingWeight(OrdersInfo ordersInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrdersByShippingWeight(ordersInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateOrderSelectionInfo(OrderSelectionInfo orderSelectionInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrderSelectionInfo(orderSelectionInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateOrdersIsCancel(string orderID, string isCancel)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrdersIsCancel(orderID, isCancel, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateOrdersPackingType(List<string> orderID, string packingType)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrdersPackingType(orderID, packingType, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateShipmentContainer(List<ShipmentContainerInfo> shipmentContainerInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateShipmentContainer(shipmentContainerInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateShippingOrderDetailInfo(OrderDetailInfo orderDetailInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrderDetailInfo(orderDetailInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateShippingOrderInfo(OrdersInfo ordersInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateOrdersInfo(ordersInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateShippUDFByOrderID(List<OrderDetailInfo> orderDetailInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateShippUDFByOrderID(orderDetailInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }

        public string UpdateWave(WaveInfo waveInfo)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            string result = string.Empty;
            OutboundServiceClient client = new OutboundServiceClient("WSHttpBinding_IOutboundService");
            try
            {
                result = client.UpdateWave(waveInfo, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return result;
        }
    }
}

